#pragma once

#include <string>
#include <vector>
#include <algorithm>
using std::string;
using std::vector;

class CVarTypeCvt
{
public:
	CVarTypeCvt(void);
	~CVarTypeCvt(void);

public:
	static bool StrToHex(string& _HexStr,unsigned char* _Digest, int _Count);
	static string HexToStr(unsigned char* _Digest, int _Count, bool _IsUppercase = true);

	static string& replace_all(string& _SrcStr,const string& _OldStr,const string& _NewStr);
	static string& replace_all_distinct(string& _SrcStr,const string& _OldStr,const string& _NewStr);

	static string& trim(string& _SrcStr,string _TirmChars = " ");
	static string& trim_left(string& _SrcStr,string _TirmChars = " ");
	static string& trim_right(string& _SrcStr,string _TirmChars = " ");

	static string& split_of_last(string& _SrcStr, char _ChDelim = '.', string* _pBefore = NULL, string* _pAfter = NULL);
	static string& split_of_first(string& _SrcStr, char _ChDelim = '.', string* _pBefore = NULL, string* _pAfter = NULL);
	static int split_by(string _SrcStr, vector<string>& _StrList, char _ChDelim = '.', bool _IsIgnoreSpace = true);
	static void fast_split_by(const string& _SrcStr, vector<string>& _StrList, char _ChDelim = '.');
};
